package base.thread_JUC2.chapter01.demo009;

import java.util.concurrent.TimeUnit;

public class testCase {

    public static void main(String[] args) {
//        UnsafeTask unsafeTask = new UnsafeTask();
//        for (int i = 0; i < 3; i++) {
//            Thread thread = new Thread(unsafeTask);
//            thread.start();
//            try {
//                TimeUnit.SECONDS.sleep(2);
//            } catch (InterruptedException e) {
//                e.printStackTrace();
//            }
//        }



        SafeTask safeTask = new SafeTask();
        for (int i = 0; i < 3; i++) {
            Thread thread = new Thread(safeTask);
            thread.start();
            try {
                TimeUnit.SECONDS.sleep(2);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
        }

    }



}
